//
//  UdpServerUtil.h
//  TestTcpUdp
//
//  Created by leeson zhong on 2021/7/19.
//

#import <Foundation/Foundation.h>

NS_ASSUME_NONNULL_BEGIN

@protocol  UdpServerUtilDelegate
@optional
-(void)onUdpServerReceiveNewConnectionIp:(NSString *)ip Port:(int)port;
-(void)onUdpServerReceiveData:(NSData *)data ClientIp:(NSString *)clientIp ClientPort:(int)clientPort;
-(void)onUdpServerClose;

@end

@interface UdpServerUtil : NSObject

@property (nonatomic,weak) id<UdpServerUtilDelegate> delegate;

-(BOOL)initWithServerPort:(int)port;
-(BOOL)sendData:(NSData *)data;
-(void)close;

-(int)getServerPort;
-(NSString *)getClientIp;
-(int)getClientPort;

@end

NS_ASSUME_NONNULL_END
